/**
 * Copyright (c) Software Institude of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.model.uml.IntermediateActivities;
// imports:
import org.w3c.dom.Element;

import edu.pku.sei.gefcommon.descriptor.annotation.MethodProperty;
import edu.pku.sei.modeler.model.common.*;
import edu.pku.sei.modeler.model.core.*;
import edu.pku.sei.modeler.model.xml.XMLUtility;

import edu.pku.sei.modeler.model.uml.Kernel.VisibilityKind;
import edu.pku.sei.modeler.model.uml.Kernel.UMLElement;
import edu.pku.sei.modeler.model.uml.BasicActivities.ActivityEdge;
import edu.pku.sei.modeler.model.uml.FundamentalActivities.ActivityNode;
import edu.pku.sei.modeler.model.uml.Dependencies.Dependency;

import edu.pku.sei.modeler.model.uml.FundamentalActivities.ActivityGroup;
import edu.pku.sei.modeler.uml.modelHelper.ModelPackage;

/**
 * @generated
 *
 */
public class ActivityPartition extends ActivityGroup implements IActivityPartition {
	// attributes
	
	protected boolean isDimension;
	
	protected boolean isExternal;
	
	
	
	protected String name;
	
	protected VisibilityKind visibility;
	
	protected String qualifiedName;
	
	
	// references
	
	protected MetaTypedList represents;
	
	protected MetaTypedList containedEdge;
	
	protected MetaTypedList containedNode;
	
	
	
	protected MetaTypedList supplierDependency;
	
	// getters & setters for attributes
	
	@MethodProperty(
			id = "ACTIVITYPARTITION_ISDIMENSION",
			catalog = "Model",
			name = ModelPackage.ACTIVITYPARTITION_ISDIMENSION,
			setter = "setisDimension"
			)
	
	public boolean getIsDimension() {
		return isDimension;
	}
	public void setIsDimension(boolean newIsDimension) {
		boolean oldisDimension = isDimension;
		isDimension = newIsDimension;
		firePropertyChange(ModelPackage.ACTIVITYPARTITION_ISDIMENSION, oldisDimension, newIsDimension);
	}
	
	@MethodProperty(
			id = "ACTIVITYPARTITION_ISEXTERNAL",
			catalog = "Model",
			name = ModelPackage.ACTIVITYPARTITION_ISEXTERNAL,
			setter = "setisExternal"
			)
	
	public boolean getIsExternal() {
		return isExternal;
	}
	public void setIsExternal(boolean newIsExternal) {
		boolean oldisExternal = isExternal;
		isExternal = newIsExternal;
		firePropertyChange(ModelPackage.ACTIVITYPARTITION_ISEXTERNAL, oldisExternal, newIsExternal);
	}
	
	@MethodProperty(
			id = "ACTIVITYPARTITION_NAME",
			catalog = "Model",
			name = ModelPackage.NAMEDELEMENT_NAME,
			setter = "setName"
			)
	
	public String getName() {
		return name;
	}
	public void setName(String newName) {
		String oldname = name;
		name = newName;
		firePropertyChange(ModelPackage.NAMEDELEMENT_NAME, oldname, newName);
	}
	
	public VisibilityKind getVisibility() {
		return visibility;
	}
	public void setVisibility(VisibilityKind newVisibility) {
		VisibilityKind oldvisibility = visibility;
		visibility = newVisibility;
		firePropertyChange(ModelPackage.NAMEDELEMENT_VISIBILITY, oldvisibility, newVisibility);
	}
	
	@MethodProperty(
			id = "ACTIVITYPARTITION_QUALIFIEDNAME",
			catalog = "Model",
			name = ModelPackage.NAMEDELEMENT_QUALIFIEDNAME,
			setter = "setqualifiedName"
			)
	
	public String getQualifiedName() {
		return qualifiedName;
	}
	public void setQualifiedName(String newQualifiedName) {
		String oldqualifiedName = qualifiedName;
		qualifiedName = newQualifiedName;
		firePropertyChange(ModelPackage.NAMEDELEMENT_QUALIFIEDNAME, oldqualifiedName, newQualifiedName);
	}
	
	// getters for references
	
	public MetaTypedList getRepresents() {
		if(represents == null) {
			represents = new MetaTypedList(UMLElement.class, this, ModelPackage.ACTIVITYPARTITION_REPRESENTS);
		}
		return represents;
	}
	
	public MetaTypedList getContainedEdge() {
		if(containedEdge == null) {
			containedEdge = new MetaTypedList(ActivityEdge.class, this, ModelPackage.ACTIVITYPARTITION_CONTAINEDEDGE);
		}
		return containedEdge;
	}
	
	public MetaTypedList getContainedNode() {
		if(containedNode == null) {
			containedNode = new MetaTypedList(ActivityNode.class, this, ModelPackage.ACTIVITYPARTITION_CONTAINEDNODE);
		}
		return containedNode;
	}
	
	public MetaTypedList getSupplierDependency() {
		if(supplierDependency == null) {
			supplierDependency = new MetaTypedList(Dependency.class, this, ModelPackage.NAMEDELEMENT_SUPPLIERDEPENDENCY);
		}
		return supplierDependency;
	}
	
	// save & load
	public void serialize(Element root) {
		super.serialize(root);
		// attributes
		
		XMLUtility.xmlInstance.serializeAttribute(root, ModelPackage.ACTIVITYPARTITION_ISDIMENSION, isDimension);
		
		XMLUtility.xmlInstance.serializeAttribute(root, ModelPackage.ACTIVITYPARTITION_ISEXTERNAL, isExternal);
		
		XMLUtility.xmlInstance.serializeAttribute(root, ModelPackage.NAMEDELEMENT_NAME, name);
		
		XMLUtility.xmlInstance.serializeNode(root, ModelPackage.NAMEDELEMENT_VISIBILITY, visibility);
		
		XMLUtility.xmlInstance.serializeAttribute(root, ModelPackage.NAMEDELEMENT_QUALIFIEDNAME, qualifiedName);
		
		// references
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.ACTIVITYPARTITION_REPRESENTS, represents);		
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.ACTIVITYPARTITION_CONTAINEDEDGE, containedEdge);		
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.ACTIVITYPARTITION_CONTAINEDNODE, containedNode);		
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.NAMEDELEMENT_SUPPLIERDEPENDENCY, supplierDependency);		
		
	}
	
	public void deSerialize(Element root) {
		super.deSerialize(root);
		// attributes
		
		isDimension = XMLUtility.xmlInstance.deSerializeBoolean(root, ModelPackage.ACTIVITYPARTITION_ISDIMENSION);
		
		isExternal = XMLUtility.xmlInstance.deSerializeBoolean(root, ModelPackage.ACTIVITYPARTITION_ISEXTERNAL);
		
		name = XMLUtility.xmlInstance.deSerializeString(root, ModelPackage.NAMEDELEMENT_NAME);
		
		visibility = (VisibilityKind)XMLUtility.xmlInstance.deSerializeNode(root, ModelPackage.NAMEDELEMENT_VISIBILITY, this);
		
		qualifiedName = XMLUtility.xmlInstance.deSerializeString(root, ModelPackage.NAMEDELEMENT_QUALIFIEDNAME);
		
		// references
		
		this.getRepresents().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.ACTIVITYPARTITION_REPRESENTS, this));
		
		this.getContainedEdge().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.ACTIVITYPARTITION_CONTAINEDEDGE, this));
		
		this.getContainedNode().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.ACTIVITYPARTITION_CONTAINEDNODE, this));
		
		this.getSupplierDependency().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.NAMEDELEMENT_SUPPLIERDEPENDENCY, this));
		
	}
	
	public void dynamicSet(String featureID, Object value) {
		if(featureID == null || "".equals(featureID)) {
			return;
		}
		// attributes
		
		else if(ModelPackage.NAMEDELEMENT_VISIBILITY.equals(featureID)) {
			visibility = (VisibilityKind)value;
		}
		
		// references
		
		else if(ModelPackage.ACTIVITYPARTITION_REPRESENTS.equals(featureID)) {
			getRepresents().add(value);
		}
		
		else if(ModelPackage.ACTIVITYPARTITION_CONTAINEDEDGE.equals(featureID)) {
			getContainedEdge().add(value);
		}
		
		else if(ModelPackage.ACTIVITYPARTITION_CONTAINEDNODE.equals(featureID)) {
			getContainedNode().add(value);
		}
		
		else if(ModelPackage.NAMEDELEMENT_SUPPLIERDEPENDENCY.equals(featureID)) {
			getSupplierDependency().add(value);
		}
		
		else
			super.dynamicSet(featureID, value);
	}
}
 
 
 
 
 